package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortString {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("我");
        list.add("我真帅帅");
        list.add("我真帅");
        list.add("我真");

        Collections.sort(list,(o1, o2) -> o1.length()-o2.length());
        System.out.println(list);









        /*
        List<String> list = new ArrayList<>();
        list.add("lee");
        list.add("cool");
        list.add("Good");
        list.add("nice");
        list.add("want");
        list.add("King");
        System.out.println("list原始数据:"+list);

        Collections.sort(list);//按照ASCII码来排序
        System.out.println("list排序后:"+list);


         */

    }
}
